package com.mouseoverstudio.brekee.command;

import com.mouseoverstudio.brekee.Command;
import com.mouseoverstudio.brekee.exception.WrongSyntaxException;

public class List extends Command {
	
	private StringBuffer bashCommand;
	
	public List(String type) {
		bashCommand = new StringBuffer();
		append("ls ");
		if (type.equals("folders")) {
			append("-d */ ");
		} else if (type.equals("files")) {
			/* TODO: List only files */
		} else if (!type.equals("all")) {
			throw new WrongSyntaxException();
		}
	}
	
	public List files() {
		return append(" ");
	}
	
	public List folders() {
		return append("-d */ ");
	}
	
	public String toBashCommand() {
		return bashCommand.toString();
	}
	
	
	private List append(String str) {
		bashCommand.append(str);
		return this;
	}

}
